<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

/**
 * @property int $id
 * @property string $name
 * @property string $openid
 * @property string $nickname
 * @property string $name_py_f
 * @property string $name_py_s
 * @property string $email
 * @property string $phone
 * @property string $avator
 * @property boolean $is_supper_admin
 * @property boolean $is_admin
 * @property boolean $status
 * @property boolean $is_locked
 * @property string $last_login_at
 * @property string $last_login_ip
 * @property string $access_token
 * @property string $binding
 * @property boolean $ding_status
 * @property string $ding_user_id
 * @property string $ding_nickname
 * @property int $ding_phone
 * @property string $updated_at
 * @property string $created_at
 */
class MiniUser extends Authenticatable implements JWTSubject
{
    use  Notifiable;

    /**
     * @var array
     */
    protected $fillable = ['name', 'openid', 'nickname', 'name_py_f', 'name_py_s', 'email', 'phone', 'avator', 'is_supper_admin', 'is_admin', 'status', 'is_locked', 'last_login_at', 'last_login_ip', 'access_token', 'binding', 'ding_status', 'ding_user_id', 'ding_nickname', 'ding_phone', 'updated_at', 'created_at'];

    public function getJWTIdentifier()
    {
        return $this->getKey();
        // TODO: Implement getJWTIdentifier() method.
    }

    public function getJWTCustomClaims()
    {
        return ['role'=>"miniApp"];
        // TODO: Implement getJWTCustomClaims() method.
    }

    public function roomCheckInfo(): \Illuminate\Database\Eloquent\Relations\HasOne
    {
        return $this->hasOne(RoomCheckIn::class,'openid','openid');
    }


}
